package com.ruoyi.yljf.controller.AppController;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.security.annotation.Anonymous;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.yljf.domain.Classify;
import com.ruoyi.yljf.domain.vo.ClassifyVO;
import com.ruoyi.yljf.service.IClassifyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.Arrays;
import java.util.List;
import java.util.Map;

/**
 * 科室分类管理Controller
 * 
 * @author metaee
 * @date 2025-02-24
 */

@RestController
@RequestMapping("/api/classify")
public class APIClassifyController extends BaseController {
    @Autowired
    private IClassifyService classifyService;

    /**
     * 查询科室分类列表
     */
    @Anonymous
    @GetMapping("/list")
    public AjaxResult list() {
        List<ClassifyVO> list = classifyService.queryClassifyList();
        return success(list);
    }

    /**
     * 通过parent_id查询所有二级分类
     */
    @GetMapping(value = "/{parentId}")
    public AjaxResult getInfo(@PathVariable("parentId") Long parentId) {
        return success(classifyService.queryByParentId(parentId));
    }


}
